
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

ADD_DEFINITIONS(
	-g
	-DPOSIX
	-D__USE_GNU 
	-D__GNU_SOURCE
  -DENABLE_INT8=ON
)

link_libraries(
  dl
  rt
  m
  pthread
  stdc++
  -rdynamic
)

SET(CMAKE_CXX_FLAGS 
    "${CMAKE_CXX_FLAGS} ${O_FLAG} -fPIC -std=c++11 -Wno-deprecated-declarations -ffunction-sections -fdata-sections -Werror"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY  "${CMAKE_SOURCE_DIR}/bin/${PLATFORM}")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY  "${CMAKE_SOURCE_DIR}/bin/${PLATFORM}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY  "${CMAKE_SOURCE_DIR}/bin/${PLATFORM}")

set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/comm/platform/${PLATFORM}/opencv/lib/cmake/opencv4)
find_package(OpenCV REQUIRED)

add_definitions(-D_ENABLE_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma")



# FIND_PACKAGE(OpenMP)
# if(OPENMP_FOUND)
#     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
#     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# endif()
